﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dst
{
    class SubCountComparer : IComparer<Exp>
    {
        int IComparer<Exp>.Compare(Exp x, Exp y)
        {
            if (x is Ele && y is Ele)
                return 0;
            else if (y is Ele)
                return 1;
            else if (x is Ele)
                return -1;

            if (x is AddExp<Exp> && y is AddExp<Exp>)
                return ((AddExp<Exp>)x).Count.CompareTo(((AddExp<Exp>)y).Count);

            //if (x is MulExp<Exp> && y is MulExp<Exp>)
            //    return ((MulExp<Exp>)x).Count.CompareTo(((MulExp<Exp>)y).Count);
            
            return 0;
        }
    }
}
